# Contributor: Damian Kurek <starfire24680@gmail.com>
# Maintainer: Damian Kurek <starfire24680@gmail.com>
pkgname=kodi-game-libretro-beetle-pcfx
pkgver=0.9.36.15
_realname=Matrix
pkgrel=0
pkgdesc="Beetle-pcfx for Kodi"
options="!check" # no test suite
url="https://github.com/kodi-game/game.libretro.beetle-pcfx"
arch="x86 x86_64 aarch64 armv7" # kodi
license="GPL-2.0-only"
makedepends="cmake kodi-dev"
depends="kodi-game-libretro libretro-beetle-pcfx"
source="$pkgname-$pkgver-$_realname.tar.gz::https://github.com/kodi-game/game.libretro.beetle-pcfx/archive/$pkgver-$_realname.tar.gz"
builddir="$srcdir/game.libretro.beetle-pcfx-$pkgver-$_realname"

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_MODULE_PATH=/usr/lib/cmake/kodi \
		-DUSE_LTO=1
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
	rm -r "$pkgdir"/usr/lib/kodi/addons/game.libretro.beetle-pcfx/game.libretro.beetle-pcfx.so
	ln -s /usr/lib/libretro/mednafen_pcfx_libretro.so \
		"$pkgdir"/usr/lib/kodi/addons/game.libretro.beetle-pcfx/game.libretro.beetle-pcfx.so
}

sha512sums="d701ba504608c7b666b44426373b20a55e83544808d7e782e10a1a7aad49b3aff89325b9dbf7292fd704fc2ebed5a2f34c63d56f4154240d0856c1b3bea49461  kodi-game-libretro-beetle-pcfx-0.9.36.15-Matrix.tar.gz"
